<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="apple-wap-web-app-capable" content="yes">
    <meta name="apple-wap-web-app-status-bar-style" content="black-translucent">
    <meta name="MobileOptimized" content="240"/>
    <title>转职业战队</title>
    <link rel="stylesheet" href="$!webPath/css/reset.css" />
    <link rel="stylesheet" href="$!webPath/css/style.css" />
    <link rel="stylesheet" href="$!webPath/css/style_my.css" />
    <script type="text/javascript" src="$!webPath/js/jquery.min.js" ></script>
    <script src="$!webPath/js/jquery.form1.js"></script>
</head>
<body style="background-color:#fff">
<div class="all">
    <div class="teamTop">
        <div class="teamName">
            <div>请上传战队成员的身份证照片，以便身份验证</div>
        </div>
    </div>
    <div class="teamList">
        #foreach($obj in $!teamMember)
        <div class="teamListbox">
            <div class="tLAvatar">
                #if($!obj.userLocalPicPath)
                <img src="$!obj.userLocalPicPath" width="100%">
                #elseif($!obj.userWxPicPath)
                <img src="$!obj.userWxPicPath" width="100%">
                #else
                <img src="$!webPath/imgs/member.jpg" width="100%">
                #end
            </div>
            <div class="tLName">
                $!obj.userName
            </div>
            <div class="tLPhone">
                $!obj.mobile
            </div>
            <div class="tLBtn">
                <input type="hidden" id="btn$!obj.id" value="$!obj.id"/>
                <div id="" onclick="fileImg('$!obj.id')">上传</div>
            </div>
        </div>
        #end
        <div id="openDiv" class="openDiv" style="display: none;width: 100%;height: 260px;">
            <form method="post" name="theForm" id="theForm"  enctype="multipart/form-data">
                <div class="divImg">
                    <img src="$!webPath/imgs/member.jpg" id="sfzImg"/>
                    <div style="padding-left: 60px;">
                        <input type="hidden" name="userId" id="userId" value=""/>
                        <input type="button" id="btnSure" value="确定"/>
                        <span id="uploadImg">
                            <input type="file" id="file" name="photo" size="1" onchange="fileChange()">
                            <input type="button" value="上传照片"/>
                        </span>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="teamFooter">
        <a href="$!webPath/team/apply_for_career1" class="btnB">上一步</a>
        <a href="javascript:void(0)" id="saveAll" class="btnY">提交申请</a>
    </div>
</div>
</body>
<script>
    $(function(){
        var mar_height=$('.teamFooter').css('height');
        $('.teamList').css('margin-bottom',mar_height);
        getUrlParam = function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]); return null;
        }
        teamId=getUrlParam('teamId');
        captionId=getUrlParam('captionId');
    })
    function fileChange(){
        var fileValue=$('#file').val();
        $('#sfzImg').attr('src',fileValue);
    }
    var userId='';
    function fileImg(id){
        $('#openDiv').css('display','block');
        userId=$('#btn'+id).val();
    }
    $('#btnSure').click(function () {
        $('#userId').val(userId);
        $("#theForm").ajaxSubmit({
            url : "$!webPath/team/upload_user_idCard",
            type : "post",
            success : function(data) {
                $('#openDiv').css('display','none');
                $('#sfzImg').attr('src','$!webPath/imgs/member.jpg');
            },
            error : function(data) {
                alert('失败');
            }
        });
    })

    $('#saveAll').click(function () {
        window.location.href = "$!webPath/team/apply_for_career3?teamId="+teamId+"&captionId="+captionId;
    })
</script>
</html>